// 管理跟用户逻辑相关的异步请求
import request from "../utils/request";

//登录
export const userLogin = (account) => {
  return request.post("/login", account); //account必须携带username、password
};

//新增角色
export const rolePost = (roleObj) => {
  return request.post("classes/VueRole", roleObj);
};

//角色列表、查询单个角色
export const roleGet = (roleId) => {
  let query = roleId ? `/${roleId}` : "";
  return request.get(`classes/VueRole${query}`);
};

//更新角色
export const rolePut = (objectId, roleObj) => {
  return request.put(`classes/VueRole/${objectId}`, roleObj);
};

//角色删除
export const roleDel = (objectId) => {
  return request.delete(`classes/VueRole/${objectId}`);
};

// 账号注册(分配账号)
export const userReg = (account) => {
  return request.post("users", account);
};

//账号列表
export const userGet = () => {
  return request.get("users");
};
